﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;

namespace Iacym.Entities
{
    public class UBIGEO:BaseEntity
    {
        public UBIGEO()
        {
            this.PERSONAs = new List<PERSONA>();
        }

        public Int32 numero { get; set; }

        [Display(Name = "Ubigeo")]
        [MaxLength(6, ErrorMessage = "Ubigeo necesita 6 dígitos")]
        [MinLength(6, ErrorMessage = "Ubigeo necesita 6 dígitos")]
        [Required(ErrorMessage = "El Ubigeo es Requerido")]
        public string IdUbigeo { get; set; }

        [Display(Name = "Departamento")]
        [Required(ErrorMessage = "El Departamento es Requerido")]
        public string Departamento { get; set; }
        [Display(Name = "Provincia")]
        [Required(ErrorMessage = "La Provincia es Requerido")]
        public string Provincia { get; set; }
        [Display(Name = "Distrito")]
        [Required(ErrorMessage = "El Distrito es Requerido")]
        public string Distrito { get; set; }       
        public virtual ICollection<PERSONA> PERSONAs { get; set; }

        public string UbigeoCompleto
        {
            get
            {
                return Departamento + " - " + Provincia + " - " + Distrito;
            }
        }

        public override string ToString()
        {
            return Departamento + " - " + Provincia + " - " + Distrito ;
        }
    }
}
